package pers.xiaoliang.concurrency.example.singleton;

import lombok.extern.slf4j.Slf4j;
import pers.xiaoliang.concurrency.annotation.ThreadSafe;

/**
* @description: 单例发布对象(饿汉模式 - 线程安全(性能不好))
* @author: xiaoliang.liu
* @date: 2018/7/28 13:36
* @version v1.0
*/
@Slf4j
@ThreadSafe
public class SingletonExample2 {

    private SingletonExample2() {}

    /** 单例对象 */
    private static SingletonExample2 instance = new SingletonExample2();

    /** 静态工厂方法 */
    public static SingletonExample2 getInstance() {
        return instance;
    }

    public static void main(String[] args) {

    }
}
